//
//  CWJavaScriptApi.h
//  CWDevelop
//
//  Created by LittoCats on 7/9/14.
//  Copyright (c) 2014 Littocats. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CWJavaScriptContext.h"
#import "CWCore.h"

#import <objc/objc-runtime.h>

#define kJavaScriptCallBackFunctionKey @"kJSAPICallBackFuncKey_Littocats"

/**
 *  定义 api
 *  @param api 名称
 */
#define CWJavascriptApi(...) +(void)__VA_ARGS__:(id)params action:(NSDictionary *)action

/**
 *  当前 api 的异步回调函数
 */
#define CWJSCALLBACK action[kJavaScriptCallBackFunctionKey]

/**
 *  当前 api 的执行环境(JavaScript)
 */
#define CWJSCONTEXT action[kJavaScriptContextKey]

@interface CWJavaScriptApi : NSObject

/**
 *  解析 action 参数
 */
+ (void)analyseAction:(NSMutableDictionary *)action;
@end
